package com.flopbox.server;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author lasse
 */
public class FileInfo implements Serializable, Comparable<FileInfo> {
    private Date modified;
    private String filename;
    private boolean deleted;
    
    public FileInfo(Date modified, String filename){
        this.modified = modified;
        this.filename = filename;
    }
    
    public FileInfo(Date modified, String filename, boolean deleted){
        this.modified = modified;
        this.filename = filename;
        this.deleted = deleted;
    }

    public Date getModified() {
        return modified;
    }
    
    public void setDeleted(boolean delState){
        modified = new Date();
        deleted = true;                
    }

    public void setModified(Date modified) {
        this.modified = modified;
    }

    public String getFilename() {
        return filename;
    }

    public boolean isDeleted() {
        return deleted;
    }
    @Override
    public String toString(){
        SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
        return "FileName "+this.filename+":LastModified "+sdf.format(this.modified)+":Deleted "+this.deleted;
        
    }

    @Override
    public int compareTo(FileInfo fi) {
        return this.filename.compareTo(fi.filename);
    }

 
}
